import cv2
import numpy as np

img = cv2.imread(r'./02.png')
# height,width=img.shape[:2]
height = img.shape[0]
width = img.shape[1]
numHeight = np.uint8(height/32)
numWidth = np.uint8(width/32)
new_img = np.zeros((height, width, 3), np.uint8)
# new_img=np.zeros(img.shape,np.uint8)

for i in range(32):
    y = i*numHeight
    for j in range(32):
        x = j * numWidth
        b = img[y, x][0]
        g = img[y, x][1]
        r = img[y, x][2]

        for n in range(numHeight):
            for m in range(numWidth):
                new_img[y+n, x+m][0] = b
                new_img[y + n, x + m][1] = g
                new_img[y + n, x + m][2] = r
cv2.imshow('img', img)
cv2.imshow('new_img', new_img)
cv2.waitKey()
cv2.destroyAllWindows()
